Skip to content

Update C implementations for Verlet algorithms #298

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 24, 2018

Conversation

berquist
Copy link
Member

Done according to #257.


while (pos > 0) {
time += dt;
(*time) += dt;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need the brackets there.

}

void stormer_verlet(double pos, double acc, double dt) {
double prev_pos, temp_pos, time, vel;
void stormer_verlet(double *time, double *vel, double pos, double acc, double dt) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is too long, move the double dt) { part on a new line.

double time, vel;
vel = 0;
time = 0;
void velocity_verlet(double *time, double *vel, double pos, double acc, double dt) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is also too long.

velocity_verlet(5.0, -10, 0.01);
double time_v;
double time_sv, vel_sv;
double time_vv, vel_vv;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not have one time and velocity variable since you set it to zero at the start of every function.

@Gathros Gathros added the Implementation Edit This provides an edit to an algorithm implementation. (Code and maybe md files are edited.) label Jul 24, 2018
Copy link
Contributor

@Gathros Gathros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@Gathros Gathros merged commit 7addd8c into algorithm-archivists:master Jul 24, 2018
@berquist berquist deleted the verlet-c branch July 24, 2018 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Implementation Edit This provides an edit to an algorithm implementation. (Code and maybe md files are edited.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants